<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0,
           maximum-scale=1.0, minimum-scale=1.0"/>
    <title>angular自定义过滤器</title>
</head>
<body>
<!--初始化中全部是以key=value来书写的-->
    <div ng-app="nihao">
        <div ng-cloak ng-controller="fristController">
            {{name |bianliang}}
            {{name |value:3:5}}
        </div>

        <div ng-cloak ng-controller="frist">
            {{aaa |filterHao:555:666}}
        </div>
    </div>
</body>

<script src="js/angular.js"></script>
<!--第一步引入包-->
<script src="js/main.js"></script>
<!-- 注意这个地方是type不是src哦-->
<script type="text/javascript">
    //第二步注入
    var app= angular.module("nihao",['myapp2']);
    app.controller("fristController", function ($scope) {
        $scope.name="hello AngularJs I Love it";
    });

    /*自定义过滤器*/
    app.filter('bianliang', function () {
        return function(name){
            return name.replace(/hello/,"你好");
        }
    })

    app.filter('value', function () {
        return function(name,ln1,ln2){
            //此处属于回调
            return name+":"+ln1+":"+ln2;
        }
    })
</script>
</html>